I have Dictionary which contains string as key and System.Object as value.
Dictionary<string, System.Object> test = new Dictionary<string, System.Object>();
I create and add values
Debug.Log("Key:" + (string)KEY.obj);
Debug.Log("VALUE:" + (string)VALUE.obj);
test.Add((string)KEY.obj, VALUE.obj);
if (test.ContainsKey("id")){
Debug.Log("contains!");
}
else{
Debug.Log("does not contain!");
}
Debug Console
KEY and VALUE is an object of class
private sealed class ResolveValue {
public readonly System.Object obj;
public readonly int end;
public ResolveValue(System.Object obj, int end){
this.obj = obj;
this.end = end;
}
}
Where KEY is "id" and VALUE is "myData".
Took me quite a while to find the problem.
How is this possible?
Additional information
All string are converter from bytes.
Here's a debug i made.
Debug.Log("--------");
string msg = "";
foreach(byte b in bytes){
msg += b + " ";
}
Debug.Log(msg);
Debug.Log("--------");
string message = System.Text.Encoding.UTF8.GetString(bytes);
Debug.Log(message);
ResolveValue response = new ResolveValue(message, end);
Variable end is an integer and has nothing to do with this problem.